package com.tj.tj_java.controller;

import com.tj.tj_java.result.Result;
import com.tj.tj_java.service.FavoriteService;
import com.tj.tj_java.service.MusicService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.*;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

@Slf4j
@RestController
public class MusicController {
    @Autowired
    private MusicService musicService;

    //获取首页全部音乐 收藏状态 模糊查询
    @GetMapping("/getHomeMusicList")
    public Result getAllMusicByUserId(@RequestParam Integer userId, @RequestParam String musicTitle) {
        System.out.println("收藏歌曲列表->"+userId+" "+musicTitle);
        return musicService.homeMusicList(userId, musicTitle);
    }

    //根据歌曲id查询歌曲 播放音乐
    @GetMapping("/getMusic/{musicId}")
    public Result getMusicById(@PathVariable int musicId) {
        System.out.println("播放音乐->" + musicId);
        return musicService.getMusicById(musicId);
    }


    


}
